define(function(require, exports, module) {
    'use strict';

    var $ = require('jquery');

    $.fn.serializeJSON=function(){
        try {
            var serializeObj={};
            var array=this.serializeArray();
            var str=this.serialize();
            $(array).each(function(){
                if(serializeObj[this.name]){
                    if($.isArray(serializeObj[this.name])){
                        serializeObj[this.name].push(this.value);
                    }else{
                        serializeObj[this.name]=[serializeObj[this.name],this.value];
                    }
                }else{
                    serializeObj[this.name]=this.value;
                }
            });
            return serializeObj;
        } catch (e) {
            console.error("表单数据转json失败！");
        }
    };

});
